FROM alpine:3.19.0

# Add worker user
RUN mkdir -p /builds && \
    adduser -h /builds/worker -s /bin/ash -D worker && \
    mkdir /builds/worker/artifacts && \
    chown worker:worker /builds/worker/artifacts

# Update repositories
RUN apk update

# Setup Python
RUN apk add --no-cache python3 py3-pip py3-setuptools && \
    ln -sf python3 /usr/bin/python

# Setup other dependencies
RUN apk add bash coreutils git

# %include-run-task

ENV SHELL=/bin/ash \
    HOME=/builds/worker \
    PATH=/builds/worker/.local/bin:$PATH

VOLUME /builds/worker/checkouts
VOLUME /builds/worker/.task-cache/pip

# Set a default command useful for debugging
CMD ["/bin/ash"]
